<div class="row-content am-cf">
    <div class="row">
        <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
            <div class="widget am-cf">
                <form id="my-form" class="am-form tpl-form-line-form" method="post">
                    <div class="widget-body">
                        <fieldset>
                            <div class="widget-head am-cf">
                                <div class="widget-title am-fl">新增代言人</div>
                            </div>
                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">服务商类型 </label>
                                <div class="am-u-sm-9 am-u-end">
                                    <select name="agentuser[type]" id="type">
                                        <option value="1">城市运营商</option>
                                        <option value="2">城市合伙人</option>

                                    </select>
                                </div>
                            </div>
                            <div class="am-form-group" id="company">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">用户名</label>
                                <div class="am-u-sm-9 am-u-end">
                                    <input type="text" class="tpl-form-input" name="agentuser[user_name]" value=""
                                           required>
                                </div>
                            </div>
                            <div class="am-form-group" id="company">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">密码</label>
                                <div class="am-u-sm-9 am-u-end">
                                    <input type="password" class="tpl-form-input" name="agentuser[password]" value=""
                                           required>
                                </div>
                            </div>
                            <div class="am-form-group" id="personal">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">代言人姓名</label>
                                <div class="am-u-sm-9 am-u-end">
                                    <input type="text" class="tpl-form-input" name="agentuser[real_name]" value=""
                                           required>
                                </div>
                            </div>
                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">手机号码</label>
                                <div class="am-u-sm-9 am-u-end">
                                    <input type="text" class="tpl-form-input" name="agentuser[mobile]" value=""
                                           required>
                                </div>
                            </div>
                            <div class="am-form-group">
                                <div class="am-u-sm-9 am-u-sm-push-3 am-margin-top-lg">
                                    <button type="submit" class="j-submit am-btn am-btn-secondary">提交</button>
                                </div>
                            </div>
                        </fieldset>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<script>
    /**
     *判断是城市合伙人还是运营商
     */
    $(document).on("change", "#type", function (e) {
        var type = $("#type").val();
        if (type == 1) {
            $('#personal').hide();
            $('#company').show();
        } else {
            $('#personal').show();
            $('#company').hide();
        }
    });
    $(function () {

        /**
         * 表单验证提交
         * @type {*}
         */
        $('#my-form').superForm();

    });
</script>
